package pl.edu.agh.ki.neuralnetwork;

import pl.edu.agh.ki.neuralnetwork.layer.Layer;
import pl.edu.agh.ki.neuralnetwork.network.NeuralNetwork;

public class Utils {
	/**
	 * Build string with printable network structure
	 * @param network Neural network
	 * @return network description
	 * @throws Exception
	 */
    public static String networkToString(NeuralNetwork network) throws Exception {
        StringBuilder sb = new StringBuilder();
        int size = network.getLayersNumber();
        for(int i=0; i<size; i++) {
            Layer layer = network.getLayer(i);
            sb.append("Layer "+i+":\n");
            for(int j=0; j<layer.size(); j++) {
                sb.append("\t"+layer.get(j)+"\n");
            }
        }
        return sb.toString();
    }
}